package cc.rengu.redp.common.utils;

import com.alibaba.fastjson.JSONObject;

public class ObjectCopyUtil {

    /**
     * 使用FastJson实现对象深拷贝
     * @param srcObj
     * @param targetClass
     * @param <T>
     * @param <S>
     * @return
     */
    public static <T , S> T copy(S srcObj, Class<T> targetClass) {
        return JSONObject.parseObject(JSONObject.toJSONString(srcObj), targetClass);
    }
}
